@{
        string Title = Model.WithoutSettings.String(BlogKeys.Title);
        string PageTitle = Context.String(BlogKeys.Title) + (string.IsNullOrWhiteSpace(Title) ? string.Empty : " - " + Title);
}

<!DOCTYPE html>
<html lang="en">
        <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=Edge"/>

        <title>@PageTitle</title>
        <meta name="description" content="@Context.String(BlogKeys.Description)" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0">        

        @if (Context.String(BlogKeys.RssPath) != null) {
        <link type="application/rss+xml" rel="alternate" title="@Context.String(BlogKeys.Title)" href="@Context.GetLink(Context.String(BlogKeys.RssPath))" />
        }
        @if (Context.String(BlogKeys.AtomPath) != null) {
        <link type="application/atom+xml" rel="alternate" title="@Context.String(BlogKeys.Title)" href="@Context.GetLink(Context.String(BlogKeys.AtomPath))" />
        }
        <link rel="shortcut icon" href="@Context.GetLink("/favicon.ico")" type="image/x-icon">
        <link rel="icon" href="@Context.GetLink("/favicon.ico")" type="image/x-icon">

        <link href="@Context.GetLink("/assets/css/bootstrap.min.css")" rel="stylesheet" />
        <link href="@Context.GetLink("/assets/css/highlight.css")" rel="stylesheet">
        <link href="@Context.GetLink("/assets/css/clean-blog.css")" rel="stylesheet" />
        <link href="@Context.GetLink("/assets/css/master.css")" rel="stylesheet" />
        <link href="@Context.GetLink("/assets/css/font-awesome.min.css")" rel="stylesheet" type="text/css">
        <link href='//fonts.googleapis.com/css?family=Lora:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
        <link href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
        <link href="@Context.GetLink("/assets/css/override.css")" rel="stylesheet" />


        <meta name="application-name" content="@Context.String(BlogKeys.Title)" />
        <meta name="msapplication-tooltip" content="@Context.String(BlogKeys.Title)" />
        <meta name="msapplication-starturl" content="@Context.GetLink("/")" />

        <meta property="og:title" content="@PageTitle" />
        @* <meta property="og:image" content="@Blog.Image" /> *@
        <meta property="og:type" content="website" />
        <meta property="og:url" content="@Context.GetLink(Model, true)" />
        <!-- TODO: More social graph meta tags -->

        @Html.Partial("_Head")

        </head>
        <body>
                
                <!-- Navigation -->
                <nav class="navbar navbar-default navbar-custom navbar-fixed-top">
                        <div class="container-fluid">
                                <!-- Brand and toggle get grouped for better mobile display -->
                                <div class="navbar-header page-scroll">
                                        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
                                        <span class="sr-only">Toggle navigation</span>
                                        <span class="icon-bar"></span>
                                        <span class="icon-bar"></span>
                                        <span class="icon-bar"></span>
                                        </button>
                                        <a class="navbar-brand" href="@Context.GetLink("/")">@Context.String(BlogKeys.Title)</a>
                                </div>
                        
                                <!-- Collect the nav links, forms, and other content for toggling -->
                                <div class="collapse navbar-collapse" id="navbar-collapse">
                                        <ul class="nav navbar-nav navbar-right">
                                                @Html.Partial("_Navbar") 
                                        </ul>
                                </div>
                                <!-- /.navbar-collapse -->
                        </div>
                        <!-- /.container -->
                </nav>
                
                <!-- Page Header -->
                @{
                        string backgroundImage = null;
                        if(Model.String(BlogKeys.Image) != null)
                        {
                                backgroundImage = $"background-image: url(\"{Model.String(BlogKeys.Image)}\")";
                        }
                }
                <header class="intro-header" id="intro-header" style="@backgroundImage">
                        <div class="container">
                                <div class="row">
                                        <div class="col-md-12">
                                                @if(IsSectionDefined("Header"))
                                                {
                                                        @RenderSection("Header")
                                                }
                                                else
                                                {
                                                        @Html.Partial("_Header")                                            
                                                }
                                        </div>
                                </div>
                        </div>
                </header>
                
                <!-- Main Content -->
                <div class="container">
                        <div class="row">
                                <div id="content" class="col-md-12">
                                        @RenderBody()
                                </div>
                        </div>
                </div>
                
                <hr>
                
                <!-- Footer -->
                <footer>
                        @Html.Partial("_Footer")
                </footer> 

                <script src="@Context.GetLink("/assets/js/jquery.min.js")"></script>
                <script src="@Context.GetLink("/assets/js/bootstrap.min.js")"></script>     
                <script src="@Context.GetLink("/assets/js/highlight.pack.js")"></script>   
                <script src="@Context.GetLink("/assets/js/clean-blog.js")"></script>
                <script src="@Context.GetLink("/assets/js/d3.v3.min.js")"></script>
                <script src="@Context.GetLink("/assets/js/trianglify.min.js")"></script>
                <script src="@Context.GetLink("/assets/js/Please-compressed.js")"></script>
                <script src="@Context.GetLink("/assets/js/background-check.min.js")"></script>

                <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
                <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
                <!--[if lt IE 9]>
                        <script src="@Context.GetLink("/assets/js/html5shiv.js")"></script>
                        <script src="@Context.GetLink("/assets/js/respond.min.js")"></script>
                <![endif]-->
                
                @Html.Partial("_Scripts")
                <script>hljs.initHighlightingOnLoad();</script>

                @if(Model.String(BlogKeys.Image) == null)
                {
                        <script type="text/javascript">                
                                // Header background                        
                                var colors = Please.make_color({
                                        colors_returned: 3,
                                        saturation: .6
                                });
                                var t = new Trianglify({
                                        x_gradient: colors,
                                        y_gradient: ["#FFFFFF"]
                                });
                                var header = document.getElementById("intro-header");
                                var pattern = t.generate(header.clientWidth, header.clientHeight);
                                header.setAttribute('style', 'background-image: ' + pattern.dataUrl);                        
                        </script>
                }

                <script>
                        BackgroundCheck.init({
                                targets: '.intro-header,.navbar',
                                images: '.intro-header'
                        });
                </script>
        </body>
</html>

